<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('Spu/index')}">商品列表</a></li>
        <li><a href="{:url('Spu/add')}">商品添加</a></li>
        <li class="active"><a href="{:url('Spu/edit',array('id'=>$news.id))}">商品编辑</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Spu/editPost')}">
        <input type="hidden" name="id" value="{$news.id}">
        <div class="form-group">
            <label for="inputTitle" class="col-sm-2 control-label">商品名称</label>
            <div class="col-sm-6">
                <input type="text" class="form-control" id="name" name="name" value="{$news.name}" placeholder="请输入商品名">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">图片<span class="form-required">*</span></label>
            <div class="col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="image" value="{$news.image}">
                <input id="photo-1-name" class="form-control" id="inputImage" type="text" name="image" value="{$news.image}" title="图片名称" disabled readonly>
                <img id="photo-1-preview" width="40px" src="/upload/{$news.image}">
                <a href="javascript:uploadOneImage('图片上传','#photo-1');" class="btn btn-primary">上传</a>
            </div>
        </div>

<!--        <div class="form-group">-->
<!--            <label for="booklet" class="col-sm-2 control-label"><span class="form-required">*</span>图册</label>-->
<!--            <div class="col-md-6 col-sm-10">-->
<!--                <foreach name="$news['images']" item="v">-->
<!--                    <img src="/upload/{$v}" style="width: 40px">-->
<!--                </foreach>-->
<!--                <ul id="photos" class="pic-list unstyled" ></ul>-->
<!--                <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-wrapper');" class="btn btn-small">选择图片</a>-->
<!--            </div>-->
<!--        </div>-->


        <div class="form-group">
            <label for="booklet" class="col-sm-2 control-label">图集</label>
            <div class="col-md-6 col-sm-10">
                <foreach name="$news['images']" item="v">
                    <img src="/upload/{$v}" style="width: 40px">
                </foreach>
                <div id="imagesContainer"></div>
                <div class="margin-top-10">
                    <a class="btn btn-default" href="javascript:uploadMultiImage('图片上传','#imagesContainer','photos-item-wrapper');">选择图片</a>
                </div>
            </div>
        </div>



        <div class="form-group">
            <label  class="col-sm-2 control-label">选择分类</label>
            <div class="col-md-6 col-sm-10">
                <select name="gid" id="" class="form-control">
                    <option value="">请选择分类</option>
                    <foreach name="spu" item="vo">
                        <option value="{$vo.id}" <eq name="$vo.id" value="$news.gid">selected </eq>>{$vo.name}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">状态</label>
            <div class="col-md-6 col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="status" value="0" <eq name="$news.status" value="0">checked </eq>>无货
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="1" <eq name="$news.status" value="1">checked </eq>>正常
                </label>
                <label class="radio-inline">
                    <input type="radio" name="status" value="2" <eq name="$news.status" value="2">checked </eq>>下架
                </label>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">是否自营</label>
            <div class="col-md-6 col-sm-10">
                <label class="radio-inline">
                    <input type="radio" name="zy" value="0" <eq name="$news.zy" value="0">checked </eq>>自营
                </label>
                <label class="radio-inline">
                    <input type="radio" name="zy" value="1" <eq name="$news.zy" value="1">checked </eq>>旗舰店
                </label>
            </div>
        </div>
        <div class="form-group">
            <label  class="col-sm-2 control-label">运费</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control"  name="rmb" value="{$news.rmb}">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    var editorcontent = new baidu.editor.ui.Editor();
    editorcontent.render('content');
</script>
<script src="__STATIC__/js/admin.js?v={$_static_version}"></script>
<script type="text/html" id="photos-item-wrapper">
    <div style="display: flex;align-items: center;border: 1px solid #ddd;padding: 5px;margin-top: 10px;">
        <div><img id="photo-{id}-preview" src="{url}" class="img-thumbnail" style="width: 100px;height: 50px;"></div>
        <div style="margin-left: 10px;">{name}</div>
        <input id="photo-{id}" type="hidden" name="images[]" value="{filepath}">
    </div>
</script>

</body>
</html>